import request from '@/config/axios'

// 日程 VO
export interface ScheduleVO {
  id: number // 编号
  title: string // 日程标题
  description: string // 详细内容
  startTime: Date // 日程开始时间
  endTime: Date // 日程结束时间
  sort: number // 排序
  status: number // 状态
}

// 日程 API
export const ScheduleApi = {
  // 查询日程分页
  getSchedulePage: async (params: any) => {
    return await request.get({ url: `/school/schedule/page`, params })
  },

  // 查询日程详情
  getSchedule: async (id: number) => {
    return await request.get({ url: `/school/schedule/get?id=` + id })
  },
  // 根据月份查询日程-查询每天是否有日程
  getScheduleByMonth: async (month: string) => {
    return await request.get({ url: `/school/schedule/get-by-month?month=` + month })
  },
  // 根据日期查询日程-查询当天的日程
  getScheduleByDay: async (day: string) => {
    return await request.get({ url: `/school/schedule/get-by-day?day=` + day })
  },
  // 新增日程
  createSchedule: async (data: ScheduleVO) => {
    return await request.post({ url: `/school/schedule/create`, data })
  },

  // 修改日程
  updateSchedule: async (data: ScheduleVO) => {
    return await request.put({ url: `/school/schedule/update`, data })
  },

  // 删除日程
  deleteSchedule: async (id: number) => {
    return await request.delete({ url: `/school/schedule/delete?id=` + id })
  },

  // 导出日程 Excel
  exportSchedule: async (params) => {
    return await request.download({ url: `/school/schedule/export-excel`, params })
  }
}
